//
//  YDDTitleView.m
//  Yuduoduo
//
//  Created by Cocoa on 2019/7/18.
//  Copyright © 2019 yibai. All rights reserved.
//

#import "YDDTitleView.h"


@implementation YDDTitleView
+ (YDDTitleView *)titleViewWithTitle:(NSString *)title {
    
    YDDTitleView *titleView = [[YDDTitleView alloc] initWithFrame:CGRectZero];
    titleView.titleLabel.text = title;
    return titleView;
}
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupUI];
    }
    return self;
}
- (void)setupUI {
    
    
    UIImageView *imgV = [[UIImageView alloc] initWithImage:UIImage.k_imgName(@"global_topTitleBg")];
    [self addSubview:imgV];
    
    self.titleLabel = [UILabel k_labelWithFontSize:15 textColor:UIColor.k_t1Color];
    [self addSubview:self.titleLabel];
    
    [imgV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self);
        make.size.mas_equalTo(CGSizeMake(245, 67));
    }];
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self);
    }];
    
}
@end
